import React from 'react';
import {Link} from "react-router-dom";
import GUtils from "@/utils";

const Config = (Action) => {
    const columns = [

        {title:"产品名称",dataIndex:"name",width:170, render:(v,vo)=><Link to={`detail/view?id=${vo.uid}`}>{v}</Link>},
        {title:"余额价值",dataIndex:"balanceAmount",width:120,render:GUtils.renderAmount},
        {title:"赠送金额",dataIndex:"giftAmount",width:120,render:GUtils.renderAmount},
        {title:"售价",dataIndex:"price",width:120,render:GUtils.renderAmount},
        {title:"限购次数",dataIndex:"limited",width:120,render:v=>v?"1次":"不限"},
        {title:"产品标签",dataIndex:"tag",width:120},
        {title:"状态",dataIndex:"enabled",width:70, render:v=>GUtils.renderEnabledValue(v)},


        {title: '操作',dataIndex: 'id',width: 150,render(id, vo){
            return <div>
                {GUtils.renderDetailLink(id,"mr-8")}
                {GUtils.renderEditLink(id,"mr-8")}
                {GUtils.renderEnabledLink(vo, "充值产品", "name", Action)}

                <span className="mr-8"></span>
                {GUtils.renderDeleteLink(vo, "充值产品", "name", Action)}
            </div>
        }},

        GUtils.renderSortOpCol(Action, "name")
    ];
    return {
        ...window.CONFIG.getPagerConfig(Action), columns
    };
};


export default Config;
